3.2.51 \(\int x^2 \sqrt {a+a \cos (x)} \, dx\) [151]

Optimal. Leaf size=53 \[ 8 x \sqrt {a+a \cos (x)}-16 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right )+2 x^2 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right ) \]

[Out]

8*x*(a+a*cos(x))^(1/2)-16*(a+a*cos(x))^(1/2)*tan(1/2*x)+2*x^2*(a+a*cos(x))^(1/2)*tan(1/2*x)

________________________________________________________________________________________

Rubi [A]
time = 0.06, antiderivative size = 53, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3400, 3377, 2717} \begin {gather*} 2 x^2 \tan \left (\frac {x}{2}\right ) \sqrt {a \cos (x)+a}+8 x \sqrt {a \cos (x)+a}-16 \tan \left (\frac {x}{2}\right ) \sqrt {a \cos (x)+a} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x^2*Sqrt[a + a*Cos[x]],x]

[Out]

8*x*Sqrt[a + a*Cos[x]] - 16*Sqrt[a + a*Cos[x]]*Tan[x/2] + 2*x^2*Sqrt[a + a*Cos[x]]*Tan[x/2]

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 3400

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[(2*a)^IntPart[n]
*((a + b*Sin[e + f*x])^FracPart[n]/Sin[e/2 + a*(Pi/(4*b)) + f*(x/2)]^(2*FracPart[n])), Int[(c + d*x)^m*Sin[e/2
 + a*(Pi/(4*b)) + f*(x/2)]^(2*n), x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && EqQ[a^2 - b^2, 0] && IntegerQ[n
 + 1/2] && (GtQ[n, 0] || IGtQ[m, 0])

Rubi steps

\begin {align*} \int x^2 \sqrt {a+a \cos (x)} \, dx &=\left (\sqrt {a+a \cos (x)} \sec \left (\frac {x}{2}\right )\right ) \int x^2 \cos \left (\frac {x}{2}\right ) \, dx\\ &=2 x^2 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right )-\left (4 \sqrt {a+a \cos (x)} \sec \left (\frac {x}{2}\right )\right ) \int x \sin \left (\frac {x}{2}\right ) \, dx\\ &=8 x \sqrt {a+a \cos (x)}+2 x^2 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right )-\left (8 \sqrt {a+a \cos (x)} \sec \left (\frac {x}{2}\right )\right ) \int \cos \left (\frac {x}{2}\right ) \, dx\\ &=8 x \sqrt {a+a \cos (x)}-16 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right )+2 x^2 \sqrt {a+a \cos (x)} \tan \left (\frac {x}{2}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.03, size = 29, normalized size = 0.55 \begin {gather*} 8 \sqrt {a (1+\cos (x))} \left (x+\frac {1}{4} \left (-8+x^2\right ) \tan \left (\frac {x}{2}\right )\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x^2*Sqrt[a + a*Cos[x]],x]

[Out]

8*Sqrt[a*(1 + Cos[x])]*(x + ((-8 + x^2)*Tan[x/2])/4)

________________________________________________________________________________________

Maple [C] Result contains complex when optimal does not.
time = 0.06, size = 70, normalized size = 1.32

method result size
risch \(-\frac {i \sqrt {2}\, \sqrt {a \left ({\mathrm e}^{i x}+1\right )^{2} {\mathrm e}^{-i x}}\, \left (4 i x \,{\mathrm e}^{i x}+x^{2} {\mathrm e}^{i x}+4 i x -x^{2}-8 \,{\mathrm e}^{i x}+8\right )}{{\mathrm e}^{i x}+1}\) \(70\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*(a+a*cos(x))^(1/2),x,method=_RETURNVERBOSE)

[Out]

-I*2^(1/2)*(a*(exp(I*x)+1)^2*exp(-I*x))^(1/2)/(exp(I*x)+1)*(4*I*x*exp(I*x)+x^2*exp(I*x)+4*I*x-x^2-8*exp(I*x)+8
)

________________________________________________________________________________________

Maxima [A]
time = 0.52, size = 36, normalized size = 0.68 \begin {gather*} 2 \, {\left (\sqrt {2} x^{2} \sin \left (\frac {1}{2} \, x\right ) + 4 \, \sqrt {2} x \cos \left (\frac {1}{2} \, x\right ) - 8 \, \sqrt {2} \sin \left (\frac {1}{2} \, x\right )\right )} \sqrt {a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(a+a*cos(x))^(1/2),x, algorithm="maxima")

[Out]

2*(sqrt(2)*x^2*sin(1/2*x) + 4*sqrt(2)*x*cos(1/2*x) - 8*sqrt(2)*sin(1/2*x))*sqrt(a)

________________________________________________________________________________________

Fricas [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(a+a*cos(x))^(1/2),x, algorithm="fricas")

[Out]

Exception raised: TypeError >>  Error detected within library code:   integrate: implementation incomplete (ha
s polynomial part)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x^{2} \sqrt {a \left (\cos {\left (x \right )} + 1\right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2*(a+a*cos(x))**(1/2),x)

[Out]

Integral(x**2*sqrt(a*(cos(x) + 1)), x)

________________________________________________________________________________________

Giac [A]
time = 0.43, size = 43, normalized size = 0.81 \begin {gather*} 2 \, \sqrt {2} {\left (4 \, x \cos \left (\frac {1}{2} \, x\right ) \mathrm {sgn}\left (\cos \left (\frac {1}{2} \, x\right )\right ) + {\left (x^{2} \mathrm {sgn}\left (\cos \left (\frac {1}{2} \, x\right )\right ) - 8 \, \mathrm {sgn}\left (\cos \left (\frac {1}{2} \, x\right )\right )\right )} \sin \left (\frac {1}{2} \, x\right )\right )} \sqrt {a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(a+a*cos(x))^(1/2),x, algorithm="giac")

[Out]

2*sqrt(2)*(4*x*cos(1/2*x)*sgn(cos(1/2*x)) + (x^2*sgn(cos(1/2*x)) - 8*sgn(cos(1/2*x)))*sin(1/2*x))*sqrt(a)

________________________________________________________________________________________

Mupad [B]
time = 0.34, size = 70, normalized size = 1.32 \begin {gather*} \frac {2\,\sqrt {a}\,\sqrt {\cos \left (x\right )+1}\,\left (x^2\,\cos \left (x\right )-8\,\cos \left (x\right )-4\,x\,\sin \left (x\right )-x^2+8+x\,4{}\mathrm {i}-\sin \left (x\right )\,8{}\mathrm {i}+x^2\,\sin \left (x\right )\,1{}\mathrm {i}+x\,\cos \left (x\right )\,4{}\mathrm {i}\right )}{\cos \left (x\right )\,1{}\mathrm {i}-\sin \left (x\right )+1{}\mathrm {i}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*(a + a*cos(x))^(1/2),x)

[Out]

(2*a^(1/2)*(cos(x) + 1)^(1/2)*(x*4i - 8*cos(x) - sin(x)*8i + x^2*cos(x) + x^2*sin(x)*1i + x*cos(x)*4i - 4*x*si
n(x) - x^2 + 8))/(cos(x)*1i - sin(x) + 1i)

________________________________________________________________________________________